import simulator
import time

class GumballSky(simulator.Simulator):
    '''
    player: explore ->  attack ->   skip -> space ->  attack
    ruins:  explore ->  attack ->   (attack ->
    temple: explore ->  open -> cancel
    monsters:
    block:  explore -> attack -> sweep -> skip -> space
    '''
    def __init__(self):
        self.delayTime = 3
        self.mouse_interval_time = self.delayTime
        self.point = {}
        self.point['explore'] = (964,622)
        self.point['attack'] = (1182, 290)
        self.point['skip'] = (1196, 979)
        self.point['open'] = (847, 620)
        self.point['cancel'] =  (1075,617)
        self.point['space'] = (964, 168)
        self.point['confirm'] = (962,664)
        self.point['sweep'] = (948, 458)
        self.point['store']= (1190,930)

    def readyGo(self):
        print('read to go ...')
        for i in range(2,0,-1):
            print('{}...'.format(i))
            time.sleep(1)
        print('go!')

    def myClick(self, pos):
        self.mouse_click(pos)
        return self.get_mouse_point() in  self.point.values()



    def run(self):
        self.readyGo()
        self.mouse_move(self.point['explore'])
        while (self.get_mouse_point() in self.point.values()):
            if not self.myClick(self.point['store']):
                break
            if not self.myClick(self.point['explore']):
                break
            if not self.myClick(self.point['attack']):
                break
            if not self.myClick(self.point['sweep']):
                break
            if not self.myClick(self.point['skip']):
                break
            if not self.myClick(self.point['space']):
                break
            if not self.myClick(self.point['attack']):
                break
            if not self.myClick(self.point['open']):
                break
            if not self.myClick(self.point['cancel']):
                break
            if not self.myClick(self.point['confirm']):
                break


    pass


gumballSky = GumballSky()

gumballSky.run()
